#!/bin/bash
# deploy remote docker test environment
# usages:   ./install-docker.sh
# env:      scheduler: api.compass-ci.openeuler.org:20014	    
# purpose:  each remote hw/vm can be a byte point for testing

[ "$USER" == "root" ] || { 
	echo "Please switch to the root user to run"
	exit 1
}
command -v git >/dev/null 2>&1 || {
	echo "Please install the git command"
	exit 1
}

mkdir -p /c/
git clone https://gitee.com/wu_fengguang/compass-ci.git /c/compass-ci

export CCI_SRC=/c/compass-ci
export LKP_SRC=/c/lkp-tests

cd $CCI_SRC/sparrow || exit 
0-package/install

mkdir -p /etc/compass-ci/
cat > /etc/compass-ci/sched.yaml <<EOF
SCHED_HOST: api.compass-ci.openeuler.org
SCHED_PORT: 20014
EOF

ruby /c/compass-ci/providers/multi-docker -n "${HOSTNAME}" -c 4 -q "${HOSTNAME}" &  
